﻿using EasyNetQ;
using NETCORE.RabbitMQ.Messages;
using System;

namespace NETCORE.RabbitMQ.Publisher
{
    class Program
    {
        static void Main(string[] args)
        {
            var connStr = "host=192.168.122.199:5672;virtualHost=vhost_lihy;username=admin;password=123456";

            using (var bus = RabbitHutch.CreateBus(connStr))
            {
                var input = "";

                Console.WriteLine("I'm Publisher");
                Console.WriteLine("Please enter a message. 'Quit' to quit.");

                while ((input = Console.ReadLine()) != "Quit")
                {
                    bus.Publish(new TextMessage
                    {
                        Text = input
                    });
                }
            }








            Console.WriteLine("Hello World!");
        }
    }
}
